/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package wli.java.db;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

/**
 *
 * @author liw
 */
@ManagedBean
@SessionScoped
public class TargetController {

    private DataModel list;
    private TargetHelper helper;
    private Target current;
    private String asset_id;

    public TargetController() {
        helper = new TargetHelper();
    }
/*
    public TargetController(String asset_id) {
        helper = new TargetHelper();
        asset_id = asset_id;
    }
*/
    public DataModel getTargetList() {
        if (list == null) {
            list = new ListDataModel(helper.getTargetList());
        }
        //System.out.println(">>>>>>>" + list.toString());
        return list;
    }

    public String prepareView() {
        current = (Target) getTargetList().getRowData();
        System.out.println(">>>>>>>" + current.getFindingStatus());
        return "index3";
    }
}
